<template>
  <div class="document-manager-wapper">
    <van-nav-bar
      title="指令操作"
      left-text="返回"
      left-arrow
      fixed
      @click-left="onClickLeft"
    >
      <van-icon name="arrow-left" slot="left" />
      <!--<van-icon name="search" slot="left"/>-->
    </van-nav-bar>
    <div class="document-content">
      <div class="document-content-div">
        <div class="cell-content">
          <van-button
            round
            type="info"
            style="width: 100%"
            @click="cellClick(0)"
            >执行指令</van-button
          >
        </div>
        <div class="cell-content">
          <van-button
            round
            type="primary"
            style="width: 100%"
            @click="cellClick(1)"
            >指令指派AGV</van-button
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "InstructionAction",
  data() {
    return {
      list: [],
      taskcodeId: "",
      loading: false,
      finished: false
    };
  },
  methods: {
    onClickLeft() {
      // this.$router.back(-1);
      this.$router.push({
          path: "/order"
      })
    },
    showInfo(id) {
      this.$router.push({
        path: "/order/info"
      });
    },
    onLoad() {
      // 异步更新数据
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.list.length + 1);
        }
        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.list.length >= 30) {
          this.finished = true;
        }
      }, 2000);
    },
    cellClick(id) {
      if (id === 0) {
        this.$router.push({
          path: "/order/execution",
          query: { taskcodeId: this.taskcodeId }
        });
      } else {
        this.$router.push({
          path: "/order/assignment",
          query: { taskcodeId: this.taskcodeId }
        });
      }
    }
  },
  created() {
    if (this.$route.query.taskcodeId != null) {
      this.taskcodeId = this.$route.query.taskcodeId;
    }
    console.info(this.taskcodeId);
  }
};
</script>

<style scoped lang="scss">
.document-manager-wapper {
  position: relative;
  height: 100%;
  .document-content {
    position: relative;
    /*top: 46px;*/
    /*height: calc(100% - 50px);*/
    /*margin-bottom: 10px;*/
    /*overflow-y: auto;*/
    top: 45%; /*偏移*/
    transform: translateY(-50%);
    .cell-content {
      margin: 10px;
      /*background: #fff;*/
      /*border-bottom: solid 1px #ddd;*/
      /*line-height: 50px;*/
      /*text-align: center;*/
      /*border-radius: 4px;*/
      /*padding-top: 50%;*/
    }
    .custom-title {
      color: #000;
      padding: 8px 0px;
    }
    .custom-title1 {
      color: #000;
      padding: 8px 0px;
      span {
        font-size: 12px;
      }
    }
    .user-line-label {
      width: 85px;
      text-align: right;
      font-size: 14px;
      color: #606266;
      line-height: 1;
      /*padding: 0px 12px 10px 0;*/
      box-sizing: border-box;
      display: inline-block;
    }
    .user-line-input {
      position: relative;
      display: inline-block;
      font-size: 14px;
      vertical-align: top;
      width: calc(100% - 85px);
    }
    .document-content-div {
    }
  }
}
</style>
